home *** CD-ROM | disk | FTP | other *** search
/ Mac Action 1996 January / mac-action-07.iso / mac / Inside Action / Total Distortion Big Demo / bePsyMap.Dxr / 00001_PsyMan.script.ls next >
Encoding:
Text File  |  1995-06-05  |  5.1 KB  |  273 lines

  1. property clrseed, editfld, rando, FieldCstLST, FieldTxLST, FieldChanLST, PsychicChanLST, FieldArtLST
  2.  
  3. on birth me
  4.   randojig(me)
  5.   setup(me)
  6.   return me
  7. end
  8.  
  9. on report me
  10.   put FieldCstLST
  11.   put FieldTxLST
  12.   put FieldChanLST
  13.   put PsychicChanLST
  14.   put FieldArtLST
  15. end
  16.  
  17. on randojig me
  18.   set rando to random(30) + random(30)
  19. end
  20.  
  21. on setup me
  22.   set FieldChanLST to [3, 4, 5, 6, 7, 8, 9, 10, 11, 12]
  23.   set FieldCstLST to []
  24.   set fldnum to the number of cast "DivNam.1"
  25.   add(FieldCstLST, fldnum)
  26.   repeat with x = 1 to 9
  27.     add(FieldCstLST, fldnum + x)
  28.   end repeat
  29.   set FieldArtLST to []
  30.   set fldnum to the number of cast "MapArtField1"
  31.   add(FieldArtLST, fldnum)
  32.   repeat with x = 1 to 9
  33.     add(FieldArtLST, fldnum + x)
  34.   end repeat
  35.   ResetText(me)
  36.   set clrseed to 0
  37. end
  38.  
  39. on ResetText me
  40.   set FieldTxLST to []
  41.   repeat with x = 1 to 5
  42.     add(FieldTxLST, "Type Name " & x & " Here")
  43.   end repeat
  44.   repeat with x = 6 to 10
  45.     add(FieldTxLST, "Type Idea " & x & " Here")
  46.   end repeat
  47.   printall(me)
  48. end
  49.  
  50. on texto me, x
  51.   global PsyMan
  52.   RandoBeepSnd()
  53.   set editfld to x
  54.   set fldnum to getAt(FieldCstLST, x)
  55.   hilite field fldnum
  56.   set tx to field fldnum
  57.   put tx into field fldnum
  58.   if x < 6 then
  59.     go("enterNam" & editfld)
  60.   else
  61.     set n to editfld - 5
  62.     go("enterIdea" & n)
  63.   end if
  64.   set keydowncmdtx to "checkkey PsyMan"
  65.   set the keyDownScript to keydowncmdtx
  66. end
  67.  
  68. on checkkey me
  69.   if (the key <> RETURN) and (the key <> TAB) then
  70.     exit
  71.   end if
  72.   if the key = RETURN then
  73.     go("setup1")
  74.     grabnames(me)
  75.     set the keyDownScript to EMPTY
  76.     exit
  77.   else
  78.     if the key = TAB then
  79.       if editfld < 10 then
  80.         set editfld to editfld + 1
  81.       else
  82.         set editfld to 1
  83.       end if
  84.       grabnames(me)
  85.       texto(me, editfld)
  86.     end if
  87.   end if
  88. end
  89.  
  90. on grabnames me
  91.   repeat with x = 1 to 10
  92.     set tx to field getAt(FieldCstLST, x)
  93.     setAt(FieldTxLST, x, tx)
  94.     put tx into field getAt(FieldArtLST, x)
  95.   end repeat
  96. end
  97.  
  98. on printall me
  99.   repeat with x = 1 to 10
  100.     put getAt(FieldTxLST, x) into field getAt(FieldCstLST, x)
  101.   end repeat
  102. end
  103.  
  104. on continue1 me
  105.   RandoResultSnd()
  106.   grabnames(me)
  107.   set PsychicChanLST to [:]
  108.   repeat with x = 1 to 5
  109.     set tx to getAt(FieldTxLST, x)
  110.     if tx starts "Type Name" then
  111.       nothing()
  112.       next repeat
  113.     end if
  114.     addProp(PsychicChanLST, 1, getAt(FieldChanLST, x))
  115.   end repeat
  116.   repeat with x = 6 to 10
  117.     set tx to getAt(FieldTxLST, x)
  118.     if tx starts "Type Idea" then
  119.       nothing()
  120.       next repeat
  121.     end if
  122.     addProp(PsychicChanLST, 2, getAt(FieldChanLST, x))
  123.   end repeat
  124.   go("colorEnter")
  125. end
  126.  
  127. on ColorEnter me, x
  128.   RandoResultSnd()
  129.   set clrseed to x
  130.   go("ready")
  131. end
  132.  
  133. on continue2 me
  134.   if clrseed = 0 then
  135.     set clrseed to random(5) + random(100)
  136.   end if
  137.   repeat with x = 1 to count(PsychicChanLST)
  138.     set chan to getAt(PsychicChanLST, x)
  139.     puppetSprite(chan, 1)
  140.     DropOn(me, chan)
  141.   end repeat
  142. end
  143.  
  144. on DropOn me, chan
  145.   set h to gridH(me)
  146.   set v to gridV(me)
  147.   set the locH of sprite chan to h
  148.   set the locV of sprite chan to v
  149. end
  150.  
  151. on gridH me
  152.   set c to clrseed
  153.   if c > 10 then
  154.     set c to c / 2
  155.   end if
  156.   if c < 2 then
  157.     set c to 2
  158.   end if
  159.   set a to random(512)
  160.   if a > c then
  161.     set a to a - random(c)
  162.   else
  163.     if a < c then
  164.       set a to a + random(c)
  165.     end if
  166.   end if
  167.   if a > 500 then
  168.     set a to 500 + random(4)
  169.   else
  170.     if a < 10 then
  171.       set a to 12 + random(4)
  172.     end if
  173.   end if
  174.   return a
  175. end
  176.  
  177. on gridV me
  178.   set c to clrseed
  179.   if c > 10 then
  180.     set c to c / 2
  181.   end if
  182.   if c < 2 then
  183.     set c to 2
  184.   end if
  185.   set a to random(384)
  186.   if a > c then
  187.     set a to a - random(c)
  188.   else
  189.     if a < c then
  190.       set a to a + random(c)
  191.     end if
  192.   end if
  193.   if a > 365 then
  194.     set a to 360 + random(4)
  195.   else
  196.     if a < 10 then
  197.       set a to 12 + random(4)
  198.     end if
  199.   end if
  200.   return a
  201. end
  202.  
  203. on BoundoH me, n
  204.   if n > 500 then
  205.     set n to 500 - random(30)
  206.   else
  207.     if n < 10 then
  208.       set n to 12 + random(4)
  209.     end if
  210.   end if
  211.   return n
  212. end
  213.  
  214. on BoundoV me, n
  215.   if n > 380 then
  216.     set n to 380 - random(30)
  217.   else
  218.     if n < 10 then
  219.       set n to 12 + random(4)
  220.     end if
  221.   end if
  222.   return n
  223. end
  224.  
  225. on PlaceIt me, chan, h, v
  226.   set the locH of sprite chan to h
  227.   set the locV of sprite chan to v
  228. end
  229.  
  230. on DrawIt me, chan, art
  231.   set the castNum of sprite chan to art
  232. end
  233.  
  234. on grabpos me
  235.   nothing()
  236. end
  237.  
  238. on slideanim me
  239.   repeat with x = 1 to count(PsychicChanLST)
  240.     set modi to random(rando * 2) - (rando + 1)
  241.     set chan to getAt(PsychicChanLST, x)
  242.     set h to the locH of sprite chan
  243.     set v to the locV of sprite chan
  244.     set h to h + modi
  245.     set h to BoundoH(me, h)
  246.     set modi to random(rando * 2) - (rando + 1)
  247.     set v to v + modi
  248.     set v to BoundoV(me, v)
  249.     PlaceIt(me, chan, h, v)
  250.   end repeat
  251. end
  252.  
  253. on RevealNames me
  254.   RandoResultSnd()
  255.   repeat with x = 1 to count(PsychicChanLST)
  256.     set chan to getAt(PsychicChanLST, x)
  257.     set the locH of sprite (chan + 10) to the locH of sprite chan - 60
  258.     set the locV of sprite (chan + 10) to the locV of sprite chan
  259.     PlaceIt(me, chan, 600, 600)
  260.   end repeat
  261. end
  262.  
  263. on ExitSession me
  264.   cleanup(me)
  265.   FirstPage()
  266. end
  267.  
  268. on cleanup me
  269.   repeat with x = 3 to 22
  270.     puppetSprite(x, 0)
  271.   end repeat
  272. end
  273.